package com.sl.discovery.core.config;

import com.sl.discovery.modular.DatabaseManager;
import com.sl.discovery.modular.discovery.DbDiscoveryClient;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

@Configuration
public class LoadbalanceConfiguration {

    @Bean
    public DatabaseManager databaseManager(DataSource dataSource) {
        return new DatabaseManager(dataSource);
    }


    @Bean
    public DiscoveryClient discoveryClient(DatabaseManager databaseManager) {
        return new DbDiscoveryClient(databaseManager);
    }

}
